package com.hubing.config;


import ch.qos.logback.core.db.DBHelper;
import com.hubing.bean.Cat;
import com.hubing.bean.User;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

@Import({User.class, DBHelper.class})
@Configuration(proxyBeanMethods = false)
@ConditionalOnMissingBean(name="Tom")
public class Myconfig {

    @Bean
    public User user01(){
        User user = new User("zhansan",20);
        user.setCat(tomcatPet());
        return user;
    }
    //@Bean("Tom")
    public Cat tomcatPet(){
        return new Cat("Tom",20);
    }
}
